package day04;

import java.util.Scanner;

public class NumDemo {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入年份");
        int a = scanner.nextInt();
        /**
         * 1
         * if (a>0){
            System.out.println("+");
        }else if (a<0){
            System.out.println("-");
        }else {
            System.out.println("0");
        }**/

        /**2
         * ---------------------------------------------------------------*/
       if (a>0){
           System.out.println("请输入月份");
           int b = scanner.nextInt();
           if ((a%4==0 && a%100!=0) || a%400 == 0){
               if ((b>=1 && b<=12)){
                   if (b == 2){
                       System.out.println(a+"年是闰年"+b+"月有 29天");
                   }else if (b<=7 && b%2 ==1){
                       System.out.println(a+"年是闰年"+b+"月有 31天");
                   }else if (b>=8 && b%2 == 0){
                       System.out.println(a+"年是闰年"+b+"月有 31天");
                   }else {
                       System.out.println(a+"年是闰年"+b+"月有 30天");
                   }
               }else {
                   System.out.println("请输入正确的月份");
               }
           }else {
               if ((b>=1 && b<=12)){
                   if (b == 2){
                       System.out.println(a+"年是闰年"+b+"月有 28天");
                   }else if (b<=7 && b%2 ==1){
                       System.out.println(a+"年是闰年"+b+"月有 31天");
                   }else if (b>=8 && b%2 == 0){
                       System.out.println(a+"年是闰年"+b+"月有 31天");
                   }else {
                       System.out.println(a+"年是闰年"+b+"月有 30天");
                   }
               }else {
                   System.out.println("请输入正确的月份");
               }
           }
       }else {
           System.out.println("输入正确的年份");
       }




//        int c = 1;
//        int b = 0;
//        while (c<=100){
//            b += c;
//            c++;
//        }
//        System.out.println(b);


//        int a = 1;
//        for (int year = 1900;year<= 2023;year++){
//            if ((year%4==0 && year%100!=0) || year%400 == 0){
//                System.out.print(year+"\t");
//                if (a%10 == 0){
//                    System.out.println();
//                }
//                a++;
//            }
//        }



    }
}
